<?php

/**
 * form_sav filter form base class.
 *
 * @package    e-DSL
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class Baseform_savFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'dossier_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('dossier'), 'add_empty' => true)),
      'date'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'fournisseur_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('fournisseur'), 'add_empty' => true)),
      'objet'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'ref_chantier'     => new sfWidgetFormFilterInput(),
      'nro_arc'          => new sfWidgetFormFilterInput(),
      'action_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('action'), 'add_empty' => true)),
      'adresse_chantier' => new sfWidgetFormFilterInput(),
      'commentaire'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'suivi_par'        => new sfWidgetFormFilterInput(),
      'tel_domicilie'    => new sfWidgetFormFilterInput(),
      'tel_travail'      => new sfWidgetFormFilterInput(),
      'tel_portable'     => new sfWidgetFormFilterInput(),
      'email'            => new sfWidgetFormFilterInput(),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'dossier_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('dossier'), 'column' => 'id')),
      'date'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'fournisseur_id'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('fournisseur'), 'column' => 'id')),
      'objet'            => new sfValidatorPass(array('required' => false)),
      'ref_chantier'     => new sfValidatorPass(array('required' => false)),
      'nro_arc'          => new sfValidatorPass(array('required' => false)),
      'action_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('action'), 'column' => 'id')),
      'adresse_chantier' => new sfValidatorPass(array('required' => false)),
      'commentaire'      => new sfValidatorPass(array('required' => false)),
      'suivi_par'        => new sfValidatorPass(array('required' => false)),
      'tel_domicilie'    => new sfValidatorPass(array('required' => false)),
      'tel_travail'      => new sfValidatorPass(array('required' => false)),
      'tel_portable'     => new sfValidatorPass(array('required' => false)),
      'email'            => new sfValidatorPass(array('required' => false)),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('form_sav_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'form_sav';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'dossier_id'       => 'ForeignKey',
      'date'             => 'Date',
      'fournisseur_id'   => 'ForeignKey',
      'objet'            => 'Text',
      'ref_chantier'     => 'Text',
      'nro_arc'          => 'Text',
      'action_id'        => 'ForeignKey',
      'adresse_chantier' => 'Text',
      'commentaire'      => 'Text',
      'suivi_par'        => 'Text',
      'tel_domicilie'    => 'Text',
      'tel_travail'      => 'Text',
      'tel_portable'     => 'Text',
      'email'            => 'Text',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
    );
  }
}
